/*
 * @Author: wuqingchun
 * @Date: 2024-07-16 10:17:20
 * @Description: 默认内存管理器的使用
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-07-16 10:35:47
 */

#include <iostream>

#include "mem_time.h"

// 有理数类定义
class Rational
{
public:
    Rational(int iNumerator=0, int iDenominator=1):
        m_iNumerator(iNumerator),
        m_iDenominator(iDenominator)
    {
    }

    ~Rational()
    {

    }

private:
    int m_iNumerator;
    int m_iDenominator;
};



int main(int argc, char** argv)
{
    Rational* apobjRational[1000];

    uint64_t ui64BeginUS, ui64EndUS;
    
    TIMESTAMP_NOW_US(ui64BeginUS);
    // 开始计时
    for (int i = 0; i < 500; i++)
    {
        for (int j = 0; j < 1000; j++)
        {
            apobjRational[j] = new (std::nothrow) Rational();
        }

        for (int j = 0; j < 1000; j++)
        {
            delete apobjRational[j];
        }
    }

    TIMESTAMP_NOW_US(ui64EndUS);
    // 结束计时

    std::cout << "Elapsed(us): " << ui64EndUS - ui64BeginUS << std::endl;

    return 0;
}